package com.rongc.client.freight.business.supply.view.adapter;

import android.content.Context;

import com.rongc.client.freight.R;
import com.rongc.client.freight.UniApplication;
import com.rongc.client.freight.base.model.BaseDic;
import com.rongc.client.freight.base.view.adapter.RecyclerBaseAdapter;
import com.rongc.client.freight.business.supply.model.SupplyBean;
import com.rongc.client.freight.business.supply.model.SupplyDic;

import java.util.List;

/**
 * Created by ccqx on 2017/6/28.
 */

public class RecyclerSupplyListAdapter extends RecyclerBaseAdapter<SupplyBean> {

    public RecyclerSupplyListAdapter(Context mContext, List<SupplyBean> mDatas) {
        super(mContext, mDatas);
    }

    @Override
    protected void onBind(final BaseRecyclerViewHolder holder, int position, SupplyBean data) {
        holder.setText(R.id.tv_address,data.getStartPlace() + " - " +data.getEndPlace());
        holder.setText(R.id.tv_date,data.getLoadTime());
        holder.setText(R.id.tv_car,data.getCarModels());
        holder.setText(R.id.tv_status, SupplyDic.getStatusStr(position));
        switch (UniApplication.getInstance().getType()) {
            case BaseDic.IdentityType.DRIVING_TYPE:
                holder.setText(R.id.tv_identity, R.string.main_title_carrier);
                break;
            case BaseDic.IdentityType.OWNER_TYPE:
                holder.setText(R.id.tv_identity, R.string.main_title_shipper);
                break;
        }
    }

    @Override
    protected int getLayoutId() {
        return R.layout.recycler_main_list_item;
    }
}
